import fs from "fs";
import  {execa}  from "execa"
import { log } from "console";
const dirs = fs.readdirSync("packages").filter(value => {
    if (!fs.statSync(`packages/${value}`).isDirectory) {
        return false;
    }
    return true;
})
async function build(target) {
    await execa("rollup", ["-c", "--environment", `TARGET:${target}`], {stdio: "inherit"})
}
function runParaller(dirs, itemFn) {
    let result=[]
    for (let item of dirs) {
        itemFn(item);
    }

    return Promise.all(result);
}

runParaller(dirs, build).then(() => {
    console.log("d");
});

console.log(dirs);


